/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.subThread;

import cn.ac.iie.di.commons.httpserver.framework.server.HttpServer;
import cn.ac.iie.di.handler.ExecuteHandler;
import cn.ac.iie.di.tools.PropsFiles;
import org.apache.log4j.Logger;

/**
 *
 * @author root
 */
public class ListernThread implements Runnable {

    private static Logger logger = Logger.getLogger(ListernThread.class);

    @Override
    public void run() {
        try {
            HttpServer httpServer = HttpServer.getHttpServer(PropsFiles.getValue("jettyServerIP"), Integer.parseInt(PropsFiles.getValue("jettyServerPort")), 32);
            httpServer.registerContext("/agent");
            httpServer.registerContextHandler("/agent", "/controller", ExecuteHandler.class);
            httpServer.startup();
        } catch (Exception ex) {
            logger.error("server start error!",ex);
        }
    }
}
